package zz.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import zz.model.User;
import zz.service.UserService;

@Controller  
@RequestMapping("/user") 
public class UserController {
	 @Resource  
	    private UserService userService;  
	      
	    @RequestMapping(value="/showUser")  
	    public String toIndex(HttpServletRequest request,Model model){  
	        int userId = Integer.parseInt(request.getParameter("id"));  
	        User user = this.userService.getUserById(userId);  
	        model.addAttribute("user", user);  
	        return "showUser";  

}
	    @RequestMapping(value="/index", produces="text/html;charset=UTF-8")  
	    public String showIndex(HttpServletRequest request,Model model){  
	    	return "index";  
	    }
}
